/* jshint indent: 2 */

module.exports = function(sequelize, DataTypes) {
  return sequelize.define('fUserIntegralRelation', {
    id: {
      type: DataTypes.INTEGER(11),
      allowNull: false,
      primaryKey: true,
      autoIncrement: true,
      field: 'id'
    },
    userId: {
      type: DataTypes.INTEGER(11),
      allowNull: true,
      field: 'user_id'
    },
    productId: {
      type: DataTypes.INTEGER(11),
      allowNull: true,
      field: 'product_id'
    },
    beginDate: {
      type: DataTypes.DATE,
      allowNull: true,
      field: 'begin_date'
    },
    endDate: {
      type: DataTypes.DATE,
      allowNull: true,
      field: 'end_date'
    },
    currentIntegral: {
      type: DataTypes.INTEGER(120),
      allowNull: true,
      defaultValue: '0',
      field: 'current_integral'
    },
    type: {
      type: DataTypes.INTEGER(1),
      allowNull: true,
      defaultValue: '0',
      field: 'type'
    },
    isUsed: {
      type: DataTypes.INTEGER(255),
      allowNull: true,
      defaultValue: '1',
      field: 'is_used'
    },
    purchaser: {
      type: DataTypes.INTEGER(11),
      allowNull: true,
      field: 'purchaser'
    },
    orderId: {
      type: DataTypes.INTEGER(11),
      allowNull: true,
      field: 'order_id'
    },
    count: {
      type: DataTypes.INTEGER(11),
      allowNull: true,
      field: 'count'
    }
  }, {
    tableName: 'f_user_integral_relation'
  });
};
